﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;

/// <summary>
/// Summary description for DBConnect
/// </summary>
public class DBConnect
{
    string strConn;

    protected SqlConnection conn;
    public DBConnect()
	{
        strConn = ConfigurationManager.ConnectionStrings["conn"].ConnectionString;
        conn = new SqlConnection(strConn);
	}
    public bool ConnectDB()
    {
        try{
            if (conn.State != ConnectionState.Open)
            conn.Open();
        }catch(Exception e)
        {
            return false;
        }
    return true;
    }
    public void Disconnect()
    {
        try
        {
            conn.Close();
        }
        catch (Exception ex) { }
    }

}